import http from '@/utils/request'


const basePath = process.env.VUE_APP_BASE_TT_AUTH

//获取验证码
export function kaptcha() {
    return http({
        url: `${basePath}/kaptcha`,
        method: "get",
        responseType: 'blob'
    })
}


//登录
export function loginByCode(data) {
    const formData = new FormData();
    formData.append("username", data.username)
    formData.append("password", data.password)
    formData.append("kaptchaInfo", data.kaptchaInfo)
    formData.append("kaptchaInfoKey", data.kaptchaInfoKey)
    return http({
        url: `${basePath}/username/token`,
        method: "post",
        data: formData,
        headers: {
            Authorization: "Basic dHQtaW06MTIzNDU2"
        }
    })
}